import { createConnection } from "mysql2/promise";
import * as _ from 'lodash'

async function main() {
  let conn = await createConnection({
    host: 'localhost',
    user: 'misty',
    password: 'cb258456',
    database: 'world'
  })

  let [ rows, fields ] = await conn.execute('select * from city')

  let cities = _.map(rows, (r) => {
    return Object.assign({}, r)
  })

  conn.end()
  console.log(conn)
  // console.log(cities)
}

main()
